/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package messages;

import java.util.ArrayList;

/**
 *
 * @author chuda
 */
public class AgentAdvertisment {

    private ArrayList<String> careOfAdress = null;
    private String flag;
    private int port;

    public AgentAdvertisment(int port) {
        this.port = port;
    }

    /**
     * @return the careOfAdress
     */
    public ArrayList<String> getCareOfAdress() {
        return careOfAdress;
    }

    /**
     * @param careOfAdress the careOfAdress to set
     */
    public void setCareOfAdress(ArrayList<String> careOfAdress) {
        this.careOfAdress = careOfAdress;
    }

    public void addCareofAdress(String coa){
        if(this.careOfAdress == null)
            setCareOfAdress(new ArrayList<String>());
        this.careOfAdress.add(coa);
    }

    /**
     * @return the flag
     */
    public String getFlag() {
        return flag;
    }

    /**
     * @param flag the flag to set
     */
    public void setFlag(String flag) {
        this.flag = flag;
    }

    @Override
    public String toString() {
        String ret = "AgentAdvertisment;";
        ret += careOfAdress.size() + ";";
        for (String string : careOfAdress) {
            ret += string + ";";
        }
        ret += this.port + ";";
        ret += flag + ";";
        return ret;
    }
}
